<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>充值明细查询</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <script type="text/javascript" src="js/jquery-1.12.4.js" ></script>
    <script type="text/javascript" src="js/bootstrap.min.js" ></script>
    <script type="text/javascript">

        $(function () {
            var state = '${rechargeOffline.state}';
            if (state == '') {
                state = -1;
            }
            $("[name='state']").val(state);

            //拿到当前页
            var currPage =${pager.currPage};
            //拿到最后一页
            var totalPages =${pager.totalPages};

            if (currPage <= 1) {
                $("#prev").removeAttr("href");
            }
            if (currPage >= totalPages) {
                $("#next").removeAttr("href");
            }

        });

        function toPage(page) {
            $("#myForm").attr("action", "rechargeOfflineSelect?currPage=" + page);
            $("#myForm").submit();
        }

        function aa() {
            $("[name='state']").val("-2");
            $("[name='time1']").val("");
            $("[name='time2']").val("");
        }
    </script>

</head>

<body>
<c:if test="${param.op == 'insertYes' }">
    <script>
        alert("新增成功");
    </script>
</c:if>
<c:if test="${param.op == 'insertNo' }">
    <script>
        alert("新增失败");
    </script>
</c:if>

<form id="myForm" action="./rechargeOfflineSelect" method="post">

    <center>
        时间范围<input type="date" name="time1" value="${time1}"/>
        <input type="date" name="time2" value="${time2}"/>
        状态
        <select name="state">
            <option value="-2">全部</option>
            <option value="0">审核中</option>
            <option value="1">审核成功</option>
            <option value="-1">审核拒绝</option>
        </select>

        <input type="submit" value="查询"/><br>
        <a href="/toInsertRechargeOffline">新增</a>
        <Br/>

    </center>
    <table align="center" width="70%" border="1px">
        <tr align="center">
            <td>平台账号</td>
            <td>交易号</td>
            <td>充值时间</td>
            <td>充值金额</td>
            <td>充值状态</td>
        </tr>
        <c:forEach items="${list}" var="detail" varStatus="st">
            <tr align="center"
                    <c:if test="${st.index %2 ==0 }">
                        style="background-color:gray"
                    </c:if>
            >
                <td>${detail.bankInfo.bankname }</td>
                <td>${detail.tradeCode }</td>
                <td><fmt:formatDate value="${detail.tradeTime}" pattern="yyyy-MM-dd"/></td>
                <td>${detail.amount }</td>
                <td>
                    <c:if test="${detail.state== 0 }">审核中</c:if>
                    <c:if test="${detail.state== 1 }">审核通过</c:if>
                    <c:if test="${detail.state==-1 }">审核拒绝</c:if>
                </td>
            </tr>
        </c:forEach>
    </table>
    <center>
        <a href="javaScript:toPage(1)">首页</a>&nbsp;&nbsp;
        <a id="prev" href="javaScript:toPage(${pager.currPage-1 })">上一页</a>&nbsp;&nbsp;
        <a id="next" href="javaScript:toPage(${pager.currPage+1 })">下一页</a>&nbsp;&nbsp;
        <a href="javaScript:toPage(${pager.totalPages})">尾页</a>&nbsp;&nbsp;
        <span>第${pager.currPage }页/共${pager.totalPages }页</span>
    </center>

</form>

</body>
</html>
